/**
 * 系统项目名称
 * com.yunmai.scale.db.manager
 * DBRequest.java
 * <p>
 * 2015-2-26-上午10:09:02
 * 2015云麦公司-版权所有
 */
package com.yunmai.library.db;

import com.j256.ormlite.stmt.StatementBuilder;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * DBRequest
 *
 * YUNMAI
 *
 * 2015-2-26 上午10:09:02
 * @param <T>
 *
 *
 */
public class DBRequest<T> {

    private List<T> t = new ArrayList<T>();
    private Class<T> clazz;
    private int action;
    private IDBManagerListener iListener;
    private Object result;
    private StatementBuilder<Object, ?> queryBuilder;
    private boolean needListenChange = true;

    public void addObj(T t) {
        this.t.add(t);
    }

    public List<T> getObj() {
        return t;
    }

    public void setObj(List<T> obj) {
        if (obj != null)
            this.t.addAll(obj);
    }

    public T getOne() {
        if (t.size() > 0) {
            return t.get(t.size() - 1);
        }
        return null;
    }

    public int getAction() {
        return action;
    }

    public void setAction(int action) {
        this.action = action;
    }

    public Class<T> getClazz() {
        return clazz;
    }

    public void setClazz(Class<T> clazz) {
        this.clazz = clazz;
    }

    public IDBManagerListener getiListener() {
        return iListener;
    }

    public void setiListener(IDBManagerListener iListener) {
        this.iListener = iListener;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public StatementBuilder<Object, ?> getQueryBuilder() {
        return queryBuilder;
    }

    public void setQueryBuilder(StatementBuilder<Object, ?> queryBuilder) {
        this.queryBuilder = queryBuilder;
    }

    public boolean isNeedListenChange() {
        return needListenChange;
    }

    public void setNeedListenChange(boolean needListenChange) {
        this.needListenChange = needListenChange;
    }


}
